package org.performancetracker;

import org.performancetracker.api.Aggregator;

/**
 * @author: jaronschut
 */

public abstract class AggregatorFactory {

	public static final String AGGREGATOR_FACTORY_IMPLEMENTATION = AggregatorFactory.class.getName();

	private static AggregatorFactoryImpl AGGREGATOR_FACTORY = new FactoryHelper<AggregatorFactoryImpl>()
				.instantiate(AggregatorFactoryImpl.class, AGGREGATOR_FACTORY_IMPLEMENTATION);

	/**
	 * Get or create new a trackerAggregator with the name.
	 *
	 * @param aggregatorName
	 * @return
	 */
    public static final Aggregator createTrackerAggregator(String aggregatorName) {
        return AGGREGATOR_FACTORY.createTrackerAggregator(aggregatorName);
    }

	/**
	 * Get or create the default trackerAggregator.
	 *
	 * @return
	 */
    public static final Aggregator createTrackerAggregator() {
        return AGGREGATOR_FACTORY.getDefaultTrackerAggregator();
    }

	/**
	 * Return the factory used to create the aggregators.
	 *
	 * @return
	 */
	public static final AggregatorFactoryImpl getAggregatorFactory() {
		return AGGREGATOR_FACTORY;
	}

	/**
	 * Return the class name of the factory used to create the trackers.
	 *
	 * @return
	 */
	public static final String getAggregatorFactoryImplementation() {
		return AGGREGATOR_FACTORY_IMPLEMENTATION;
	}
}